//fmod.h
//Contains the FMOD Implementation
//Justin Renga/Griffin Milsap

#ifndef FMOD_H
#define FMOD_H

// Include Files
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stack>
#include <iostream>
#include "fmod/fmod.hpp"
#include "fmod/fmod_errors.h"

// Define Global Variables
#define OUTPUTRATE 48000
#define SPECTRUMSIZE 8192
#define SPECTRUMRANGE ((float)OUTPUTRATE / 2.0f)      /* 0 to nyquist */
#define BINSIZE (SPECTRUMRANGE / (float)SPECTRUMSIZE)

class fmodEX
{
public:
	fmodEX();
	~fmodEX();
	void fmod_Init();
	void fmod_refresh();
	float currentFrequency() { return mCurrentFrequency; }
	int getSample() { return sample; }
	void pauseSound();
	void go();

private:
	void ERRCHECK(FMOD_RESULT result);
	void getFrequency(int spectrumSize, float multi, float spectrum[], FMOD::Channel *channel);

	FMOD::System *system;
	FMOD::Sound *sound1;
	FMOD::Channel *channel;
	float mCurrentFrequency;
	int sample;
};

#endif //FMOD_H